package org.example.springcache.controller;


import org.example.springcache.domain.User;
import org.example.springcache.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserController {

    @Autowired
    private IUserService userService;

    @RequestMapping("/getid")
    public User getId(int id) {
        return userService.getUserById(id);
    }

    @RequestMapping("update")
    public User update(@RequestBody User user) {
        return userService.update(user);
    }

    @RequestMapping("delete")
    public void delete(int id) {
        userService.delete(id);
    }

}
